package sg.edu.nus.iss.phoenix.schedule.service;

import sg.edu.nus.iss.phoenix.schedule.dao.ScheduleDAO;
import sg.edu.nus.iss.phoenix.schedule.dao.impl.ScheduleDAOImpl;
import sg.edu.nus.iss.phoenix.schedule.entity.ProgramSlot;

import java.util.ArrayList;

/**
 * @author tham
 */
public class ScheduleService {
    /**
     * GetProgramSlots-method. This method retrieves the program slots  based on the year and week returns a list of program slots.
     *
     * @param year The year
     * @param week week in the year
     */
    public ArrayList<ProgramSlot> GetProgramSlots(int year, int week) {
        ScheduleDAO myDAO = new ScheduleDAOImpl();
        return myDAO.GetProgramSlots(year, week);
    }

    /**
     * GetAllProgramSlots-method. This method retrieves all the program slots from the database
     */
    public ArrayList<ProgramSlot> GetAllProgramSlots() {
        ScheduleDAO myDAO = new ScheduleDAOImpl();
        return myDAO.GetAllProgramSlots();
    }

    /**
     * CreateProgramSlot-method. This method creates a program slot
     *
     * @param slotInsert The program slot to insert
     */
    public boolean CreateProgramSlot(ProgramSlot slotInsert) {
        ScheduleDAO myDAO = new ScheduleDAOImpl();
        return myDAO.CreateProgramSlot(slotInsert);
    }

    /**
     * DeleteProgramSlot-method. This method deletes a program slot from the database
     *
     * @param slot The program slot to delete
     */
    public boolean DeleteProgramSlot(ProgramSlot slot) {
        ScheduleDAO myDAO = new ScheduleDAOImpl();
        return myDAO.DeleteProgramSlot(slot);
    }

    /**
     * ModifyProgramSlot-method. This method modifies a program slot in the database
     *
     * @param slot the program slot to modify
     */
    public boolean ModifyProgramSlot(ProgramSlot slot) {
        ScheduleDAO myDAO = new ScheduleDAOImpl();
        return myDAO.ModifyProgramSlot(slot);
    }
}
